package com.ailk.bi.cq.cqbiaudit.warmMsgInfo.control
{
	import com.ailk.bi.cq.cqbiaudit.common.Util;
	import com.ailk.bi.cq.cqbiaudit.vo.ResultVO;
	import com.ailk.bi.cq.cqbiaudit.warmMsgInfo.model.WarmMsgInfoModel;
	
	import flash.events.EventDispatcher;
	
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;
	
	public class WarmMsgInfoControl extends EventDispatcher
	{
		[Bindable]
		private var warmMsgInfoModel:WarmMsgInfoModel =  WarmMsgInfoModel.getInstance();
		
		private var _service:RemoteObject;
		
		public function WarmMsgInfoControl()
		{
			_service = new RemoteObject();
			this._service.destination = "warmMsgInfoService";
			this._service.endpoint = "messagebroker/amf";
			_service.addEventListener(FaultEvent.FAULT, Util.faultHandler);
			_service.getWarmMsgData.addEventListener(ResultEvent.RESULT,getWarmMsgDataResult);
			
		}
		
		public function getWarmMsgData():void{
			this._service.getWarmMsgData();
		}
		
		
		private function getWarmMsgDataResult(event:ResultEvent):void{
			var result:ResultVO = this._service.getWarmMsgData.lastResult;
			warmMsgInfoModel.dataXML = new XML(result.xmlString);
		}
	}
}